<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>iicps: Main Page</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.gif"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">iicps
   </div>
   <div id="projectbrief">Xilinx SDK Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('index.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">iicps Documentation</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>This is an implementation of IIC driver in the PS block. The device can be either a master or a slave on the IIC bus. This implementation supports both interrupt mode transfer and polled mode transfer. Only 7-bit address is used in the driver, although the hardware also supports 10-bit address.</p>
<p>IIC is a 2-wire serial interface. The master controls the clock, so it can regulate when it wants to send or receive data. The slave is under control of the master, it must respond quickly since it has no control of the clock and must send/receive data as fast or as slow as the master does.</p>
<p>The higher level software must implement a higher layer protocol to inform the slave what to send to the master.</p>
<p><b>Initialization &amp; Configuration</b></p>
<p>The <a class="el" href="struct_x_iic_ps___config.html" title="This typedef contains configuration information for the device. ">XIicPs_Config</a> structure is used by the driver to configure itself. This configuration structure is typically created by the tool-chain based on HW build properties.</p>
<p>To support multiple runtime loading and initialization strategies employed by various operating systems, the driver instance can be initialized in the following way:</p>
<ul>
<li>XIicPs_LookupConfig(DeviceId) - Use the device identifier to find the static configuration structure defined in <a class="el" href="xiicps__g_8c.html">xiicps_g.c</a>. This is setup by the tools. For some operating systems the config structure will be initialized by the software and this call is not needed.</li>
</ul>
<p>XIicPs_CfgInitialize(InstancePtr, CfgPtr, EffectiveAddr) - Uses a configuration structure provided by the caller. If running in a system with address translation, the provided virtual memory base address replaces the physical address in the configuration structure.</p>
<p><b>Multiple Masters</b></p>
<p>More than one master can exist, bus arbitration is defined in the IIC standard. Lost of arbitration causes arbitration loss interrupt on the device.</p>
<p><b>Multiple Slaves</b></p>
<p>Multiple slaves are supported by selecting them with unique addresses. It is up to the system designer to be sure all devices on the IIC bus have unique addresses.</p>
<p><b>Addressing</b></p>
<p>The IIC hardware can use 7 or 10 bit addresses. The driver provides the ability to control which address size is sent in messages as a master to a slave device.</p>
<p><b>FIFO Size </b> The hardware FIFO is 32 bytes deep. The user must know the limitations of other IIC devices on the bus. Some are only able to receive a limited number of bytes in a single transfer.</p>
<p><b>Data Rates</b></p>
<p>The data rate is set by values in the control register. The formula for determining the correct register values is: Fscl = Fpclk/(22 x (divisor_a+1) x (divisor_b+1))</p>
<p>When the device is configured as a slave, the slck setting controls the sample rate and so must be set to be at least as fast as the fastest scl expected to be seen in the system.</p>
<p><b>Polled Mode Operation</b></p>
<p>This driver supports polled mode transfers.</p>
<p><b>Interrupts</b></p>
<p>The user must connect the interrupt handler of the driver, XIicPs_InterruptHandler to an interrupt system such that it will be called when an interrupt occurs. This function does not save and restore the processor context such that the user must provide this processing.</p>
<p>The driver handles the following interrupts:</p><ul>
<li>Transfer complete</li>
<li>More Data</li>
<li>Transfer not Acknowledged</li>
<li>Transfer Time out</li>
<li>Monitored slave ready - master mode only</li>
<li>Receive Overflow</li>
<li>Transmit FIFO overflow</li>
<li>Receive FIFO underflow</li>
<li>Arbitration lost</li>
</ul>
<p><b>Bus Busy</b></p>
<p>Bus busy is checked before the setup of a master mode device, to avoid unnecessary arbitration loss interrupt.</p>
<p><b>RTOS Independence</b></p>
<p>This driver is intended to be RTOS and processor independent. It works with physical addresses only. Any needs for dynamic memory management, threads or thread mutual exclusion, virtual memory, or cache control must be satisfied by the layer above this driver.</p>
<p><b>Repeated Start</b></p>
<p>The I2C controller does not indicate completion of a receive transfer if HOLD bit is set. Due to this errata, repeated start cannot be used if a receive transfer is followed by any other transfer.</p>
<pre> MODIFICATION HISTORY:</pre><pre> Ver   Who     Date     Changes
<hr/>

 1.00a drg/jz  01/30/08 First release
 1.00a sdm     09/21/11 Fixed an issue in the XIicPs_SetOptions and
                         XIicPs_ClearOptions where the InstancePtr-&gt;Options
                         was not updated correctly.
                         Updated the InstancePtr-&gt;Options in the
                         XIicPs_CfgInitialize by calling XIicPs_GetOptions.
                         Updated the XIicPs_SetupMaster to not check for
                         Bus Busy condition when the Hold Bit is set.
                         Removed some unused variables.
 1.01a sg      03/30/12 Fixed an issue in XIicPs_MasterSendPolled where a
                         check for transfer completion is added, which indicates
                         the completion of current transfer.
 1.02a sg       08/29/12 Updated the logic to arrive at the best divisors
                         to achieve I2C clock with minimum error for
                         CR #674195
 1.03a hk  05/04/13 Initialized BestDivA and BestDivB to 0.
                         This is fix for CR#704398 to remove warning.
 2.0   hk  03/07/14 Added check for error status in the while loop that
                    checks for completion.
                    (XIicPs_MasterSendPolled function). CR# 762244, 764875.
                    Limited frequency set when 100KHz or 400KHz is
                    selected. This is a hardware limitation. CR#779290.
 2.1   hk  04/24/14 Fix for CR# 789821 to handle &gt;14 byte transfers.
                    Explicitly reset CR and clear FIFO in Abort function
                    and state the same in the comments. CR# 784254.
                    Fix for CR# 761060 - provision for repeated start.
 2.2   hk  08/23/14 Slave monitor mode changes - clear FIFO, enable
                    read mode and clear transfer size register.
                    Disable NACK to avoid interrupts on each retry.
 2.3    sk      10/07/14 Repeated start feature deleted.
 3.0    sk      11/03/14 Modified TimeOut Register value to 0xFF
                                         in XIicPs_Reset.
                        12/06/14 Implemented Repeated start feature.
                        01/31/15 Modified the code according to MISRAC 2012 Compliant.
                        02/18/15 Implemented larger data transfer using repeated start
                                          in Zynq UltraScale MP.
 3.3   kvn 05/05/16 Modified latest code for MISRA-C:2012 Compliance.
       ms  03/17/17 Added readme.txt file in examples folder for doxygen
                    generation.</pre><pre> </pre> </div></div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Copyright &copy; 2015 Xilinx Inc. All rights reserved.</li>
  </ul>
</div>
</body>
</html>
